<%--
    User: limeng
    Date: 16/4/19
    Time: 下午1:59
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Login Page">
    <meta name="author" content="Duke Li">

    <title>工会提案系统-请您登录</title>

    <link rel="stylesheet" href="../css/sbadmin/bootstrap.min.css">
    <link rel="stylesheet" href="../css/sbadmin/font-awesome.min.css">
    <link rel="stylesheet" href="../css/sbadmin/metisMenu.min.css">
    <link rel="stylesheet" href="../css/sbadmin/sb-admin-2.css">
    <link rel="stylesheet" href="../css/jquery-ui/jquery-ui.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <script src="../js/lib/jquery-1.12.0.js"></script>
    <script src="../js/lib/jquery-ui.min.js"></script>

    <script src="../js/lib/bootstrap.min.js"></script>
    <script src="../js/lib/bootbox.js"></script>
    <script src="../js/lib/metisMenu.min.js"></script>
    <script src="../js/lib/sb-admin-2.js"></script>

    <script src="../js/lib/angular.js"></script>
    <script>
        var LoginApp = angular.module("LoginApp", []);
        var LoginCtrl = LoginApp.controller("LoginCtrl", function ($rootScope, $scope, $http) {
            $scope.userId = '';
            $scope.userPwd = '';

            $scope.loginCheck = function () {
                $http.post("/json/loginCheck", {
                    userId : $scope.userId,
                    userPwd : $scope.userPwd
                }).success(function (data) {
                    if (data.state == false) {
                        bootbox.alert("登录错误, 错误原因为:" + data.result);
                    } else {
                        $rootScope.delegate = data.delegate;
                        location.href = "/delegate/index/" + $scope.userId;
                    }
                });
            };
        });

    </script>
</head>
<body>

<div class="container" ng-app="LoginApp" ng-controller="LoginCtrl">
    <div class="row">
        <div class="col-md-4 col-md-offset-4">
            <div class="login-panel panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">请您登录</h3>
                </div>
                <div class="panel-body">
                    <form role="form">
                        <fieldset>
                            <div class="form-group">
                                <input class="form-control" placeholder="请输入教工编号" type="text" id="userId" autofocus required ng-model="userId">
                            </div>
                            <div class="form-group">
                                <input class="form-control" placeholder="请输入密码" type="password" id="userPwd" required ng-model="userPwd">
                            </div>
                            <%--<div class="checkbox">
                                <label>
                                    <input name="remember" type="checkbox" value="Remember Me">Remember Me
                                </label>
                            </div>--%>
                            <button class="btn btn-lg btn-success btn-block" id="loginBtn" ng-click="loginCheck()">
                                登录
                            </button>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
</html>
